
package com.jf.cloud.api.group.feign;

import com.jf.cloud.api.group.vo.GroupActivityVO;
import com.jf.cloud.common.feign.FeignInsideAuthConfig;
import com.jf.cloud.common.product.vo.GroupActivitySpuVO;
import com.jf.cloud.common.response.ServerResponseEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Date;
import java.util.List;

/**
 * @author zz
 * @date 2021/3/29
 */
@FeignClient(value = "jfcloud-group",contextId ="group")
public interface GroupFeignClient {

    /**
     * 获取活动开始的时间（预热的活动开始时间为当前）
     * @param activityId 活动id
     * @return void
     */
    @PostMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/group/getActivityStartTime")
    ServerResponseEntity<Date> getActivityStartTime(@RequestParam("activityId") Long activityId);

    /**
     * 获取活动信息
     * @param activityId 活动id
     * @return void
     */
    @PostMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/group/getActivityInfo")
    ServerResponseEntity<GroupActivityVO> getActivityInfo(@RequestParam("activityId") Long activityId);

    /**
     * 根据商品id获取团购商品信息
     * @param spuIds 商品id
     * @return void
     */
    @PostMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/group/groupSpuListBySpuIds")
    ServerResponseEntity<List<GroupActivitySpuVO>> groupSpuListBySpuIds(@RequestParam("spuIds") List<Long> spuIds);

    /**
     * 根据商品ids下线所有的团购活动
     * @param spuIds 商品ids
     * @return 返回结果
     */
    @PutMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/group/offlineGroupBySpuIds")
    ServerResponseEntity<Void> offlineGroupBySpuIds(@RequestBody List<Long> spuIds);

    /**
     * 根据skuIds更新团购活动
     * @param skuIds
     * @param spuId
     * @return
     */
    @PutMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/group/updateGroupActivityPrice")
    ServerResponseEntity<Void> updateGroupActivityPrice(@RequestParam("skuIds") List<Long> skuIds, @RequestParam("spuId") Long spuId);

    /**
     * 根据商品id和状态修改拼团活动状态
     * @param spuId
     * @return
     */
    @PutMapping(FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/group/updateGroupActivityStatus")
    ServerResponseEntity<Void> updateGroupActivityStatus(@RequestParam("spuId") Long spuId);

//    /**
//     * 计算满减，并组合购物车 + 购物车金额
//     * @param shopCartItems 购物项
//     * @return void
//     */
//    @PostMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/discount/calculateDiscountAndMakeUpShopCartAndAmount")
//    ServerResponseEntity<ShopCartWithAmountVO> calculateDiscountAndMakeUpShopCartAndAmount(@RequestBody List<ShopCartItemVO> shopCartItems);
//
//    /**
//     * 商品详情的满减活动列表
//     * @param spuId
//     * @return
//     */
//    @PostMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/discount/spuDiscountList")
//    ServerResponseEntity<List<SpuDiscountAppVO>> spuDiscountList(@RequestParam("shopId") Long shopId, @RequestParam("spuId") Long spuId);
}
